#coding=utf-8
'''
Created on 2017-7-14

@author: sandy
'''

import importlib
import ServerConfig
class GameBase(object):
    
    def __init__(self):
        pass
    
#########################interface######################## 
    
    def start(self):
        pass
    
    def stop(self):
        pass
    
    def getName(self):
        return u""
    
    def createUser(self,uid):
        return None
    
    def createTable(self, tid, hc, tabletype):
        return None
    
    def parsePacket(self, user, cmd, pkt):
        return False
    
    def onCheckUserSuc(self,uid):
        pass

    def onLoginGameResult(self,uid,code):
        pass
    
    def onUserGameInfo(self, uid):
        pass
    
    def onUserEnterHall(self, uid, hallId):
        pass
    
    def onUserLeaveHall(self, uid, hallId, reason):
        pass
    
    def onUserLeave(self, uid, reason):
        pass
    
#########################method########################  


###########################################################

instance = GameBase()

def start():
    global instance
    mname = u"{0}.{0}Game".format(ServerConfig.instance.game_type)
    mo = importlib.import_module(mname)
    instance = mo.createGame()
    instance.start()

def stop():
    instance.stop()

if __name__ == '__main__':
    pass